<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <script src="../jquery.min.js"></script>
    <script>
        $(function () {
            $('div').on('click', function () {
                alert(11);
            })
            //自动触发事件
            // 1.元素.事件会触发元素的默认行为
            // $('div').click();
            //2.元素.trigger('事件')会触发元素的默认行为
            // $('div').trigger('click');
            //2.元素.triggerHandler('事件') 就是不会触发元素的默认行为
            // $('div').triggerHandler('click');
            $('input').on('focus',function(){
                $(this).val('你好吗');
            });

        })
    </script>
    <div></div>
    <input type="text" name="" id="">
</body>

</html>